package com.yanzhu.service.mapper;

import com.yanzhu.service.model.WithdrawDeposit;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Author: 方炎柱
 * @Description:
 * @Date: Created in 22:12 2018/1/21
 * @Modified:
 */
@Mapper
public interface WithdrawDepositMapper {
    @Insert("insert into withdraw_deposit(uid, withdraw_fee, withdraw_time) values(#{uid}, #{withdraw_fee}, #{withdraw_time})")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = long.class)
    int insert(WithdrawDeposit withdrawDeposit);

    @Select("select * from withdraw_deposit" +
            " where uid = #{uid}" +
            " order by withdraw_time desc" +
            " limit #{page}, ${size}")
    List<WithdrawDeposit> queryWithdrawDepositList(@Param("uid") long uid, @Param("page") int page, @Param("size") int size);

    @Delete("delete from withdraw_deposit where id = #{id}")
    int deleteWithdrawDepositById(@Param("id") long id);

    @Delete("delete from withdraw_deposit where uid=#{uid}")
    int deleteWithdrawDepositAll(@Param("uid") long uid);
}
